<?php
$this_dir = dirname(__FILE__) . '/';
require_once($this_dir . '../../autoload.php');
class BencodeTest extends PHPUnit_Framework_TestCase
{

    public function setUp()
    {
    }

    public function testEncode()
    {
        $data = array (
          'interval' => 120,
          'min interval' => 120,
          'complete' => 1,
          'incomplete' => 0,
          'peers' => 
          array (
            array (
              'ip' => '61.135.169.79',
              'port' => 50340,
            ),
            array (
              'ip' => '61.135.169.79',
              'port' => 25608,
            ),
          ),
        );
        $r = BencodeLib::encode($data);
        $this->assertEquals('d8:completei1e10:incompletei0e8:intervali120e12:min intervali120e5:peersld2:ip13:61.135.169.794:porti50340eed2:ip13:61.135.169.794:porti25608eeee', $r);
    }
}
?>
